
const searchFormList = [
	{ label: '关键词', value: 'query', type: 'input', width: '200px' },
  { label: '隶属班级', value: 'starid', RawValue: 'star', type: 'inputSearch', width: '180px', option:"sysStar", store: "dictSrv/sysStar"},
  { label: '隶属用户', value: 'userid', RawValue: 'user', type: 'inputSearch', width: '180px', option:"appUser", store: "dictSrv/appUser"},
	{ label: '', width: '200px', value: 'btnSearch', type: 'slot' }
];

const tables = [ // 表格数据
  { label: '记录ID', value: 'id', sort:'custom'},
  { label: '活动标题', value: 'title', type: 'slot'},
  { label: '隶属用户', value: 'user', type: 'slot'},
  { label: '隶属班级', value: 'star', type: 'slot'},
  { label: '状态', value: 'status', type: 'slot'},
  { label: '是否推荐', value: 'istop', type: 'slot'},
  { label: '是否私密', value: 'isprivacy', type: 'slot'},
  { label: '隐藏金额', value: 'ishidden', type: 'slot'},
  { label: '起售日期', value: 'start'},
  { label: '结束日期', value: 'expire'},
  { label: '销售金额', value: 'amount', width:70},
  { label: '销售数量', value: 'sales', width:70},
  { label: '是否物流', value: 'isaddress', type: 'slot'},
  { label: '更新时间', value: 'stime'}
];

const fieldList = [ // 新增弹出数据
  { label: '标题', value: 'title', type: 'input', width: '460px', className:'block'},
  { label: '状态', value: 'status', type:'select', width: '180px', option: 'saleStatus', filterable: true, className:'block'},
  { label: '是否推荐', value: 'istop', type:'select', width: '180px', option: 'yesOrNo', filterable: true, className:'block'},
  { label: '商品描述', value: 'datas', type:'editor', width: '840px', ueditorStyle:{width:'720px', height:'240px'}, className:''},
];

const rules = {
	title: [{ required: true, message: '请输入标题', trigger: 'change' }],
	status: [{ required: true, message: '请设置状态', trigger: 'change' }],
  istop: [{ required: true, message: '请设置是否推荐', trigger: 'change' }],
  content: [{ required: true, message: '请编辑帖子内容', trigger: 'change' }]
};

const fieldData = (data)=>{
  var dataset = {};
  for (var idx = 0; idx < fieldList.length; idx++) {
    var ckey  = fieldList[idx].value;
    dataset[ckey] = (data)? data[ckey]:'';
  }
  dataset.id = (data && data.id)? data.id:0;
  return dataset;
}

export default {
  searchFormList,tables,fieldList,fieldData,rules
};